package com.jiayang.business.equipmentinfopage;

import com.jiayang.business.equipmentinfopage.domain.dto.AlarmHandlingFormDTO;
import com.jiayang.business.infraredpage.domain.dto.PointTemperatureDTO;
import com.jiayang.business.equipmentinfopage.domain.dto.ThresholdDTO;
import com.jiayang.common.anno.OperateLog;
import com.jiayang.common.domain.ResponseDTO;
import com.jiayang.constant.SwaggerTagConst;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @ Author     ：OuyangChenglong
 * @ Date       ：Created in 9:56 2021/9/8
 * @ Description：设备信息页
 * @ Modified By：
 * @Version: 1.0$
 */
@RestController
@Api(tags = {SwaggerTagConst.Admin.CLIENT_EQUIPMENT_INFO})
@OperateLog
public class EquipmentInfoController {

    @Autowired
    private EquipmentInfoService equipmentInfoService;

    @GetMapping("/equipmentInfo/initGetEquipmentImage/{id}")
    @ApiOperation(value = "根据设备id获取所有符合当前设备的图片和传感器坐标位置", notes = "设备图片和传感器定位点 @author OuyangChenglong")
    public ResponseDTO initGetEquipmentImage(@PathVariable String id) {
        return equipmentInfoService.getEquipmentImage(id);
    }

    @GetMapping("/equipmentInfo/getSensorShortInfo/{id}")
    @ApiOperation(value = "根据传感器id获取传感器简略信息", notes = "用户点击图片上的传感器触发事件 @author OuyangChenglong")
    public ResponseDTO getSensorShortInfo(@PathVariable String id) {
        return equipmentInfoService.getSensorShortInfo(id);
    }

    @GetMapping("/equipmentInfo/initGetShakeShortInfo/{id}")
    @ApiOperation(value = "根据设备id获取震动传感器运行情况", notes = "震动传感器栏 @author OuyangChenglong")
    public ResponseDTO initGetShakeShortInfo(@PathVariable String id) {
        return equipmentInfoService.getShakeShortInfo(id);
    }

    @GetMapping("/equipmentInfo/initGetInfraredShortInfo/{id}")
    @ApiOperation(value = "根据设备id获取红外摄像头运行情况", notes = "红外摄像头栏 @author OuyangChenglong")
    public ResponseDTO initGetInfraredShortInfo(@PathVariable String id) {
        return equipmentInfoService.getInfraredShortInfo(id);
    }

    @GetMapping("/equipmentInfo/initGetOilShortInfo/{id}")
    @ApiOperation(value = "根据设备id获取油液传感器运行情况", notes = "油液栏 @author OuyangChenglong")
    public ResponseDTO initGetOilShortInfo(@PathVariable String id) {
        return equipmentInfoService.getOilShortInfo(id);
    }

    @GetMapping("/equipmentInfo/initGetSensorParameter/{id}")
    @ApiOperation(value = "根据设备id获取传感器参数", notes = "传感器参数栏 @author OuyangChenglong")
    public ResponseDTO initGetSensorParameter(@PathVariable String id) {
        return equipmentInfoService.getSensorParameter(id);
    }

    @GetMapping("/equipmentInfo/initGetElectricalParameter/{id}")
    @ApiOperation(value = "根据设备id获取电参", notes = "电参栏 @author OuyangChenglong")
    public ResponseDTO initGetElectricalParameter(@PathVariable String id) {
        return equipmentInfoService.getElectricalParameter(id);
    }

    @GetMapping("/equipmentInfo/initGetEquipmentState/{id}")
    @ApiOperation(value = "根据设备id获取设备运行情况", notes = "设备运行情况栏 @author OuyangChenglong")
    public ResponseDTO initGetEquipmentState(@PathVariable String id) {
        return equipmentInfoService.getEquipmentState(id);
    }

    @GetMapping("/equipmentInfo/initGetErrorInfo/{id}")
    @ApiOperation(value = "根据设备id获取设备当前的主要故障", notes = "设备故障处理栏 @author OuyangChenglong")
    public ResponseDTO initGetErrorInfo(@PathVariable String id) {
        return equipmentInfoService.getErrorInfo(id);
    }

    @GetMapping("/equipmentInfo/initGetNamePlate/{id}")
    @ApiOperation(value = "根据设备id获取设备铭牌", notes = "设备铭牌栏 @author OuyangChenglong")
    public ResponseDTO initGetNamePlate(@PathVariable String id) {
        return equipmentInfoService.getNamePlate(id);
    }

    // 告警处理模态框 -----------------------------------------------------------------------------------------------------
    @PostMapping("/equipmentInfo/alarmHandling")
    @ApiOperation(value = "告警处理", notes = "告警处理模态框 @author OuyangChenglong")
    public ResponseDTO alarmHandling(@Valid @RequestBody AlarmHandlingFormDTO alarmHandlingFormDTO) {
        return equipmentInfoService.alarmHandling(alarmHandlingFormDTO);
    }

}
